package com.tij.rtti.typeinfo.pet;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName:
 * @author:
 * @Description: TODO
 * data:2024/10/6 21:31
 * @since
 **/
public class ForNameCreator extends PetCreator{

    private static List<Class<? extends Pet>> types = new ArrayList<Class<? extends Pet>>();

    private static String[] typeNames ={
    "com.tij.rtti.typeinfo.pet.Mutt",
    "com.tij.rtti.typeinfo.pet.Pug",
    "com.tij.rtti.typeinfo.pet.EgyptianMau",
    "com.tij.rtti.typeinfo.pet.Manx",
    "com.tij.rtti.typeinfo.pet.Cymric",
    "com.tij.rtti.typeinfo.pet.Rat",
    "com.tij.rtti.typeinfo.pet.Mouse",
    "com.tij.rtti.typeinfo.pet.Hamster"
    };

    private static void loader(){
        try {
            for (String name : typeNames) {
                types.add((Class<? extends Pet>) Class.forName(name));
            }
        }catch (Exception e){
            throw new RuntimeException(e);
        }
    }
    static{
        loader();
    }
    @Override
    public List<Class<? extends Pet>> types() {
        return types;
    }
}
